package com.itheima.manager;

import com.itheima.common.R;
import com.itheima.domain.HomeAdvertise;
import com.itheima.service.IHomeAdvertiseService;
import com.itheima.vo.PageBeanVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class SmsHomeAdvertiseManager {



    @DubboReference
    IHomeAdvertiseService homeAdvertiseService;

    public R findByPage(Integer pageSize, Integer pageNum, Integer type, String endTime, String name) {
        PageBeanVo byPage = homeAdvertiseService.findByPage(pageSize, pageNum, type, endTime, name);
        return R.success(byPage);

    }

    public R addNew(HomeAdvertise homeAdvertise) {
        homeAdvertiseService.addNew(homeAdvertise);
        return R.success(null);
    }

    public R delete(Integer[] ids) {
        homeAdvertiseService.delete(ids);
        return R.success(null);
    }

    public R updateStatus(Integer id, Integer status) {
        homeAdvertiseService.updateStatus(id,status);
        return R.success(null);
    }

    public R updateAdvertise(HomeAdvertise advertise, Integer id) {
        homeAdvertiseService.updateAdvertise(advertise,id);
        return R.success(null);
    }

    public R getAdvertise(Integer id) {
        return R.success(homeAdvertiseService.getAdvertise(id));
    }
}
